import socket

# 创建socket对象
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# 连接服务器地址和端口号
client_socket.connect(('127.0.0.1', 8888))

# 发送数据给服务器
client_socket.send(b'Hello, server! This is client 2')

# 接收服务器响应的数据
data = client_socket.recv(1024)

# 关闭连接
client_socket.close()

# 输出接收到的数据
print('Received data:', data.decode())